package com.springWebFlux.Model;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;

/**
 * @version V1.0  </br>
 * @ClassName Tweet </br>
 * @Description TODO  </br>
 * @Author tonywang</br>
 * @DATE 3/20/2019 5:21 PM</br>
 */
@Document(collection="tweets")
public class Tweet implements Serializable{
    @Id
    private String id;
    @NotBlank
    @Size(max = 140)
    private String text;
    @NotNull
    private Date createAt = new Date();

    public Tweet() {
    }

    public Tweet(@NotBlank @Size(max = 140) String pText) {
        text = pText;
    }

    public String getId() {
        return id;
    }

    public Tweet setId(String pId) {
        id = pId;
        return this;
    }

    public String getText() {
        return text;
    }

    public Tweet setText(String pText) {
        text = pText;
        return this;
    }

    public Date getCreateAt() {
        return createAt;
    }

    public Tweet setCreateAt(Date pCreateAt) {
        createAt = pCreateAt;
        return this;
    }
}
